*** REPLICATION TOOLKIT ***

* AUTHORS: CIMINELLI DUVAL FURCERI 

* ARTICLE: EMPLOYMENT PROTECTION DEREGULATION AND LABOR SHARES IN ADVANCED ECONOMIES 

* JOURNAL: REVIEW OF ECONOMICS AND STATISTICS

* OUTPUT: TABLE G3 (Online Appendix)

***************************

cd ""

putexcel set "Tables/G3", modify 

global horizon 6 

************ PREPARE DATASET **********

run "Do files/Clean dataset"

* Trends (linear, quadratic, cubic)
egen ltrend = group(year)
gen qtrend = ltrend^2
gen ctrend = ltrend^3

************ ANALYSIS **********

forvalues s = 2/4 {
mat mat`s' = J(12,$horizon,.)

* Baseline
forvalues i= 1/$horizon {
quietly reghdfe  Y`i' r`s' l1Y l2Y l3Y l4Y l1r`s' l2r`s' l3r`s' l4r`s' t`s' ${f`i'`s'}, absorb(id_cross_section i.year#id_country i.year#id_industry) cluster(ifscode year) nocons
matrix results = r(table)
mat mat`s'[1,`i'] = results[1,1]
mat mat`s'[2,`i'] = results[2,1]
mat mat`s'[3,`i'] = results[4,1]
}
* Linear trend
forvalues i= 1/$horizon {
quietly reghdfe  Y`i' r`s' l1Y l2Y l3Y l4Y l1r`s' l2r`s' l3r`s' l4r`s' t`s' ${f`i'`s'}, absorb(id_cross_section i.year#id_country i.year#id_industry i.id_cross_section#c.ltrend) cluster(ifscode year) nocons
matrix results = r(table)
mat mat`s'[4,`i'] = results[1,1]
mat mat`s'[5,`i'] = results[2,1]
mat mat`s'[6,`i'] = results[4,1]
}
* Quadratic trend
forvalues i= 1/$horizon {
quietly reghdfe  Y`i' r`s' l1Y l2Y l3Y l4Y l1r`s' l2r`s' l3r`s' l4r`s' t`s' ${f`i'`s'}, absorb(id_cross_section i.year#id_country i.year#id_industry i.id_cross_section#c.qtrend) cluster(ifscode year) nocons
matrix results = r(table)
mat mat`s'[7,`i'] = results[1,1]
mat mat`s'[8,`i'] = results[2,1]
mat mat`s'[9,`i'] = results[4,1]
}
* Cubic trend
forvalues i= 1/$horizon {
quietly reghdfe  Y`i' r`s' l1Y l2Y l3Y l4Y l1r`s' l2r`s' l3r`s' l4r`s' t`s' ${f`i'`s'}, absorb(id_cross_section i.year#id_country i.year#id_industry i.id_cross_section#c.ctrend) cluster(ifscode year) nocons
matrix results = r(table)
mat mat`s'[10,`i'] = results[1,1]
mat mat`s'[11,`i'] = results[2,1]
mat mat`s'[12,`i'] = results[4,1]
}
}

************ SAVE OUTPUT **********

putexcel B4=matrix(mat2)
putexcel B18=matrix(mat3)
putexcel B32=matrix(mat4)
